<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<script src="http://code.jquery.com/jquery-2.1.1.min.js"></script>
<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
<body>
<form method="post" action="/login">
     userId:<input type="text" id="id" name="userId"><br/>
     账号:<input type="text" id="username" name="username"><br/>
     密码:<input type="text" id="password" name="password"><br/>
    <input type="submit" id="btn" value="登录">
</form>
<script>

    const options = {
        method: 'POST',
        headers: { 'content-type': 'application/x-www-form-urlencoded' },
        data: {
             "userId":$("#id").val(),
            "username":$("#username").val(),
            "password":$("#password").val()
        },
        url:"http://localhost:8080/login",
    };

    $("#btn").click(()=>{
        axios(options).then(res=>console.log(res.data))
    })
</script>
</body>
</html>